package com.jk.vehicle.mini.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

import java.util.concurrent.Executor;


/**
 * 配置线程池
 * @author  lirui
 */
@Configuration
@EnableAsync
public class ThreadPoolConfig {

	/**
	 * 配置线程池
	 * @return
	 */
	@Bean("taskExecutor")
	public Executor defaultTreadPool() {
		ThreadPoolTaskScheduler executor = new ThreadPoolTaskScheduler();
		executor.setPoolSize(10);
		executor.setThreadNamePrefix("taskExecutor");
		executor.initialize();
		return executor;
	}
}
